# 还原
# modprobe ahci
modprobe -r ahci

# 查找 SATA 控制器 PCI 设备
echo "lspci -nn | grep SATA"
lspci -nn | grep SATA
# 示例输出: 00:17.0 SATA controller [0106]: Intel Corporation 200 Series PCH SATA controller [AHCI mode] [8086:a282]

# 查看控制器所在 IOMMU 组
echo "readlink /sys/bus/pci/devices/0000:00:17.0/iommu_group"
readlink /sys/bus/pci/devices/0000:00:17.0/iommu_group
echo "ls /sys/bus/pci/devices/0000:00:17.0/iommu_group/devices"
ls /sys/bus/pci/devices/0000:00:17.0/iommu_group/devices
# 确认组内没有其他关键设备(如 USB 控制器等)

# 1. 确保vfio相关模块已加载
modprobe vfio
modprobe vfio-pci
modprobe vfio_iommu_type1

# 3. 绑定到vfio-pci
echo "8086 43d2" | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id

# 4. 验证
lspci -nnk -s 00:17.0

